package cn.com.recode.重构方法.无局部变量;

import java.util.Enumeration;
import java.util.Vector;

public class A {

    private String name;

    private int amout;

    private Vector orders = new Vector<Order>();

    void printOwing() {
        Enumeration elements = orders.elements();
        double outstanding = 0.0;
        printBanner();

        while (elements.hasMoreElements()) {
            Order order = (Order)elements.nextElement();
            outstanding += order.getAmout();
        }

        //print details
        System.out.println("name:"+name);
        System.out.println("amout:"+outstanding);
    }

    private void printBanner() {
        System.out.println("***************************");
        System.out.println("********** *Customer Owes* *********");
        System.out.println("***************************");
    }
}
